Custom DataSource
Hello,
I read the topic on Custom DataSource but I'm not sure Business Object can meet my need.
I am using FS.Net in a stand-alone application with a personnal query builder and a virtual Table filled from MySQL database.
Just a few records are in memory at a time, they are downloaded in small pages that are discarded when no more used.
My virtual Table is not DataTable of course, it looks like Delphi's Custom DataSource with Prior or Next methods.
As I do not know the fields returned by the query (it is the end user who writes the SELECT) how can I use Business Object to link data with report ?
Many thanks for help.
Herve.
I read the topic on Custom DataSource but I'm not sure Business Object can meet my need.
I am using FS.Net in a stand-alone application with a personnal query builder and a virtual Table filled from MySQL database.
Just a few records are in memory at a time, they are downloaded in small pages that are discarded when no more used.
My virtual Table is not DataTable of course, it looks like Delphi's Custom DataSource with Prior or Next methods.
As I do not know the fields returned by the query (it is the end user who writes the SELECT) how can I use Business Object to link data with report ?
Many thanks for help.
Herve.
Comments
no problem with fastreport,
but we are talking dynamic field, i think spreadsheet is the answer
What do you meen by "spredsheet" in this context ?
Yes, fields are dynamic because the SELECT is writen dynamicly and the database structure may evoluate without recompiling my application.
Only part of the query result is loaded into memory in a virtual page. When the user skip record and the new record is out of the page, the content of this virtual page is reloaded accordingly. A bit like MySql would do with the "SELECT ... LIMIT index,count" command.
So I don't use System.Data classes at all but a specific control with specifics methods (First, Last, Next, Prior, Seek, and so on).
Is it possible to use this system with FS.Net and what is the best way to do it ?
Many thanks.
Herve
1. user creates a query in personal query builder, he/she knows the table structure of mysql database
2. app reads the result of the query, put into memory/virtual table
3. fastreport needs .net style memory table, such as business object (class) or datatable
4. you must convert virtual table to .net style
5. .net style memory table requirements:
* field, or maximum field
* datatypes
6. therefore, you must set a limit of maximum field, let's say 10 fields and all with 'string datatype'
7. design the layout of the report with myVirtualTable (business object) as datasource
8. if 10 fields too much, not fit in A4 paper size, use spreadsheet for outputting myVirtualTable
Doing so, I lose the benefit of typed fields (DateTime, Double, Boolean, Image).
I also lose columns's names that will be replaced by properties's names (field0, field1, ...)
I did the test and it quickly becomes difficult to find a specific column.
And if the query returns 5 columns, while I have provided 20 properties in the Business Object, the FS.Net TreeView DataSource will display 15 unnecessary fields.
Is there a way with a CustomDataSource derived from FastReport.Data.CustomDataSource?
1. dot net style as datasource
2. convert virtual table to dotnet style, for your case, datatable, because it can create columns on the fly, detect datatype for each field in virtual table with typeof operator, typeof(int), typeof(byte), etc
3. push datatable to fastreport, there is a demo named ReportFromCode, take a look. How to create fastreport without fastreport designer template. You must imagine the layout.
4. report is limited by paper size
IMO, fastreport still can give you the solution, but for me, i dont want to loose my hair because of this approach, easy answer, spreadsheet